<template>
  <div class="my-box">
      <div>Methods操作：</div><div><button @click="changeName">按钮</button> --- {{name}}</div>
  </div>
</template>
<script lang="ts" setup>
import { reactive, toRefs  } from 'vue';

const state = reactive({
    name: 'jerrmy'
})

//声明method 方法
const changeName = () =>{
    state.name = 'jack'
}

const {name} = toRefs(state)
</script>

<style scoped>
.my-box{
    display: flex;
}
  /* 支持CSS变量注入v-bind(color) */
</style>
